home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d21
/
dvmacros.arc
/
DV_MISC.MAC
< prev
next >
Wrap
Text File
|
1988-03-12
|
6KB
|
210 lines
.XLIST
; DV_MISC.MAC 1.0
; Daniel T. Travison Jr. 01/01/88
; misc macros for 32 bit data handling
; @PUSH, @POP, @MOVE
; NOTES:
; All TOPVIEW parameters are pushed on the stack
; as 32 bit values. These 3 macros are designed
; to simplify this process by providing names for
; common register pairs (see replacable paramaters)
; as well as 32 bit data values. I also included
; entries for CR, LF and ESCAPE since I use these
; in just about ALL desqview programs.
; All three macros manipulate the data or registers
; (push, pop, move) in the sequence that Topview
; and Desqview expect.
; USAGE:
; > Simply place the macro at the top of your primary
; source file and they will be available globally.
; > All keywords ARE case sensitive and should always
; be in upper case.
; > The macros mimic those described in The Programmer's
; Guide to Topview by Alan R. Miller. I have not
; found any case where the macros have not worked.
; Problems that have arisen were related to my
; programming errors and not the macro execution although
; I was tempted several times to think otherwise.
; > Error checking in the macros is limited. All labels
; used as parameters are asuumed to by defined as full
; words.
CR EQU 13
LF EQU 10
ESCAPE EQU 27
; Replacable parameters:
; register pairs:
; DXCX: DX and CX
; BXAX: BX and AX
; ESDI: ES and DI
; ESSI: ES and SI
; DSDI: DS and DI
; DSSI: DS and SI
;
; Memory:
; 32 bit memory area defined as 2 consecutive words
; ie: LABEL1 DW 2 DUP(0)
; @PUSH LABEL1
; @PUSH ADDR1
; ADDR1 = 32 bit address defined as 2 consecutive words
; or ADDR1 = register pair
;
; pushes 32 bit values onto the stack
; with the high 16 bits pushed 1st.
; argument is either a 16 bit memory
; address or a register pair symbol
@PUSH MACRO ADDR1
IFIDN <ADDR1>,<DXCX>
PUSH DX
PUSH CX
ELSE
IFIDN <ADDR1>,<BXAX>
PUSH BX
PUSH AX
ELSE
IFIDN <ADDR1>,<ESDI>
PUSH ES
PUSH DI
ELSE
IFIDN <ADDR1>,<ESSI>
PUSH ES
PUSH SI
ELSE
IFIDN <ADDR1>,<DSDI>
PUSH DS
PUSH DI
ELSE
IFIDN <ADDR1>,<DSSI>
PUSH DS
PUSH SI
ELSE
PUSH ADDR1 + 2
PUSH ADDR1
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDM
; @POP ADDR1
; ADDR1 = 16 bit address
; or ADDR1 = register pair
;
; pops 32 bit values off the stack
; with the low 16 bits popped 1st.
; argument is either a 16 bit memory
; address or a register pair symbol
@POP MACRO ADDR1
IFIDN <ADDR1>,<DXCX>
POP CX
POP DX
ELSE
IFIDN <ADDR1>,<BXAX>
POP AX
POP BX
ELSE
IFIDN <ADDR1>,<ESDI>
POP DI
POP ES
ELSE
IFIDN <ADDR1>,<ESSI>
POP SI
POP ES
ELSE
IFIDN <ADDR1>,<DSDI>
POP DI
POP DS
ELSE
IFIDN <ADDR1>,<DSSI>
POP SI
POP DS
ELSE
POP ADDR1
POP ADDR1 + 2
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDM
; @MOVE ADDR1,ADDR2
; ADDR1 = 16 bit address or register pair
; ADDR2 = 16 bit address or register pair
;
; moves a 32 bit value:
; register pair to memory
; memory to a register pair
@MOVE MACRO ADDR1,ADDR2
IFIDN <ADDR2>,<DXCX>
MOV ADDR1,CX
MOV ADDR1 + 2,DX
ELSE
IFIDN <ADDR2>,<BXAX>
MOV ADDR1,AX
MOV ADDR1 + 2,BX
ELSE
IFIDN <ADDR2>,<ESDI>
MOV ADDR1,DI
MOV ADDR1 + 2,ES
ELSE
IFIDN <ADDR2>,<ESSI>
MOV ADDR1,SI
MOV ADDR1 + 2,ES
ELSE
IFIDN <ADDR2>,<DSDI>
MOV ADDR1,DI
MOV ADDR1 + 2,DS
ELSE
IFIDN <ADDR2>,<DSSI>
MOV ADDR1,SI
MOV ADDR1 + 2,DS
ELSE
IFIDN <ADDR1>,<DXCX>
MOV CX,[ADDR2]
MOV DX,[ADDR2 + 2]
ELSE
IFIDN <ADDR1>,<BXAX>
MOV AX,[ADDR2]
MOV BX,[ADDR2 + 2]
ELSE
IFIDN <ADDR1>,<ESDI>
MOV DI,[ADDR2]
MOV ES,[ADDR2 + 2]
ELSE
IFIDN <ADDR1>,<ESSI>
MOV SI,[ADDR2]
MOV ES,[ADDR2 + 2]
ELSE
IFIDN <ADDR1>,<DSDI>
MOV DI,[ADDR2]
MOV DS,[ADDR2 + 2]
ELSE
IFIDN <ADDR1>,<DSSI>
MOV SI,[ADDR2]
MOV DS,[ADDR2 + 2]
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDM
.LIST